/* components */
import BizListViewTaskComponents from '@src/component/business/BizListView/Impl/BizListViewTask/BizListViewTaskComponents'
import TaskSearchPanel from '@src/modules/task/components/list/TaskSearchPanel.vue'
/* config */
import PaymentConfig from '@model/config/PaymentConfig'
/* enum */
import StorageModuleEnum from '@model/enum/StorageModuleEnum'
import TaskViewPointIdEnum from '@model/enum/TaskViewPointIdEnum'
import TaskKeywordSelectEnum from '@model/enum/TaskKeywordSelectEnum'
import StorageKeyEnum from '@model/enum/StorageKeyEnum'
/* entity */
import Task from '@model/entity/Task'
import Field from '@model/entity/Field'
import TaskType from '@model/entity/TaskType'
import CardInfo from '@model/entity/CardInfo'
import TaskException from '@model/entity/TaskException'
import TaskTypeSimple from '@model/entity/TaskTypeSimple'
/* model */
import ElementColumn from '@model/types/ElementColumn'
import TaskConfig from '@model/config/TaskConfig'
import { BizListViewTaskOptions, TaskExportGroup } from '@src/component/business/BizListView/Impl/BizListViewTask/BizListViewTaskInterface'
import { AbnormalList } from '@src/modules/task/list/TaskFieldModel' 
/* export & import */
import {taskListExport} from '@src/api/Export'

/* vue */
import { Prop, Ref } from 'vue-property-decorator'
import i18n, { t } from '@src/locales'

class BizListViewTaskData<T, P> extends BizListViewTaskComponents<T, P> {
  
  /* 工单搜索组件 */
  @Ref() readonly TaskSearchPanelComponent!: TaskSearchPanel
  
  /* 异常数据 */
  public abnormalData: TaskException = new TaskException()
  /* 异常数据字段 */
  public abnormalFields: Field[] = AbnormalList as Field[]
  /* 高级搜索列 */
  public advanceSearchColumns: Field[] = []
  /* 高级搜索字段缓存数据 */
  public advancedSearchFieldStorageKey: StorageKeyEnum | undefined = undefined
  /* 配置项 */
  public bizListViewTaskOptions: BizListViewTaskOptions = new BizListViewTaskOptions()
  /* 已选择面板列 */
  public baseSelectionPanelColumns: ElementColumn[] = [{ label: t('common.fields.taskName.displayName'), prop: 'name'}, { label: t('common.task.taskType'), prop: 'templateName' }]
  /* 当前工单类型 */
  public currentTaskType: TaskType | null = null
  /* 导出数据文件名称 */
  public exportFileName: string = t('common.base.exportName.taskList')
  /* 工单导出列 */
  public exportTaskColumns: TaskExportGroup[] = []
  /* 导出地址url */
  public exportActionUrl: string = taskListExport
  /** 
   * 搜索选项
   * 1. 表单内容
   * 2. 按工单备注
   * 3. 按附加组件
  */
  public keywordSelect: string = TaskKeywordSelectEnum.All
  /* 多选数据 */
  public multipleSelection: Task[] = []
  /* 参数 */
  public params: Record<string, any> = {}
  /* 支付配置 */
  public paymentConfig: PaymentConfig | null | undefined = null
  /* 缓存的模块名称 */
  public storageModule: StorageModuleEnum = StorageModuleEnum.Task
  /* 列表导出缓存 */
  public exportStorageKey: StorageKeyEnum = StorageKeyEnum.Empty
  /* 创建视角 id */
  public selectViewPointId: TaskViewPointIdEnum = TaskViewPointIdEnum.Empty
  /* 工单字段列表 */
  public taskFields: Field[] = []
  /* 工单回执字段列表 */
  public taskReceiptFields: Field[] = []
  /* 满意度字段列表 */
  public satisfactionFields: Field[] = []
  /* 工单附加组件字段列表 */
  public taskCardList: CardInfo[] = []
  /* 工单类型列表 */
  public taskTypes: TaskType[] = []
  /* 工单配置信息 */
  public taskConfig: TaskConfig | null | undefined = undefined
  /* 工单字段列表对象 */
  public taskFieldsMap: Record<string, Field> = {}
  public tableContainerHeight:string | undefined = '440px'
}

export default BizListViewTaskData

